/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "pyfntbpedidper")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pyfntbpedidper.findAll", query = "SELECT p FROM Pyfntbpedidper p"),
    @NamedQuery(name = "Pyfntbpedidper.findByPyfntbpedidperid", query = "SELECT p FROM Pyfntbpedidper p WHERE p.pyfntbpedidperid = :pyfntbpedidperid"),
    @NamedQuery(name = "Pyfntbpedidper.findByMesinicio", query = "SELECT p FROM Pyfntbpedidper p WHERE p.mesinicio = :mesinicio"),
    @NamedQuery(name = "Pyfntbpedidper.findByMesfin", query = "SELECT p FROM Pyfntbpedidper p WHERE p.mesfin = :mesfin"),
    @NamedQuery(name = "Pyfntbpedidper.findByMensual", query = "SELECT p FROM Pyfntbpedidper p WHERE p.mensual = :mensual"),
    @NamedQuery(name = "Pyfntbpedidper.findByFecharegistro", query = "SELECT p FROM Pyfntbpedidper p WHERE p.fecharegistro = :fecharegistro"),
    @NamedQuery(name = "Pyfntbpedidper.findByObservaciones", query = "SELECT p FROM Pyfntbpedidper p WHERE p.observaciones = :observaciones")})
public class Pyfntbpedidper implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pyfntbpedidperid")
    private Integer pyfntbpedidperid;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mesinicio")
    private int mesinicio;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mesfin")
    private int mesfin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "mensual")
    private double mensual;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fecharegistro")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecharegistro;
    @Size(max = 255)
    @Column(name = "observaciones")
    private String observaciones;
    @JoinColumn(name = "pyfntbreqperid", referencedColumnName = "pyfntbreqperid")
    @ManyToOne(optional = false)
    private Pyfntbreqper pyfntbreqperid;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pyfntbpedidperid")
    private Collection<Pyfntbpersvico> pyfntbpersvicoCollection;

    public Pyfntbpedidper() {
    }

    public Pyfntbpedidper(Integer pyfntbpedidperid) {
        this.pyfntbpedidperid = pyfntbpedidperid;
    }

    public Pyfntbpedidper(Integer pyfntbpedidperid, int mesinicio, int mesfin, double mensual, Date fecharegistro) {
        this.pyfntbpedidperid = pyfntbpedidperid;
        this.mesinicio = mesinicio;
        this.mesfin = mesfin;
        this.mensual = mensual;
        this.fecharegistro = fecharegistro;
    }

    public Integer getPyfntbpedidperid() {
        return pyfntbpedidperid;
    }

    public void setPyfntbpedidperid(Integer pyfntbpedidperid) {
        this.pyfntbpedidperid = pyfntbpedidperid;
    }

    public int getMesinicio() {
        return mesinicio;
    }

    public void setMesinicio(int mesinicio) {
        this.mesinicio = mesinicio;
    }

    public int getMesfin() {
        return mesfin;
    }

    public void setMesfin(int mesfin) {
        this.mesfin = mesfin;
    }

    public double getMensual() {
        return mensual;
    }

    public void setMensual(double mensual) {
        this.mensual = mensual;
    }

    public Date getFecharegistro() {
        return fecharegistro;
    }

    public void setFecharegistro(Date fecharegistro) {
        this.fecharegistro = fecharegistro;
    }

    public String getObservaciones() {
        return observaciones;
    }

    public void setObservaciones(String observaciones) {
        this.observaciones = observaciones;
    }

    public Pyfntbreqper getPyfntbreqperid() {
        return pyfntbreqperid;
    }

    public void setPyfntbreqperid(Pyfntbreqper pyfntbreqperid) {
        this.pyfntbreqperid = pyfntbreqperid;
    }

    @XmlTransient
    public Collection<Pyfntbpersvico> getPyfntbpersvicoCollection() {
        return pyfntbpersvicoCollection;
    }

    public void setPyfntbpersvicoCollection(Collection<Pyfntbpersvico> pyfntbpersvicoCollection) {
        this.pyfntbpersvicoCollection = pyfntbpersvicoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pyfntbpedidperid != null ? pyfntbpedidperid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pyfntbpedidper)) {
            return false;
        }
        Pyfntbpedidper other = (Pyfntbpedidper) object;
        if ((this.pyfntbpedidperid == null && other.pyfntbpedidperid != null) || (this.pyfntbpedidperid != null && !this.pyfntbpedidperid.equals(other.pyfntbpedidperid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Pyfntbpedidper[ pyfntbpedidperid=" + pyfntbpedidperid + " ]";
    }
    
}
